package org.fusesource.camel.processors;

import java.util.List;

import javax.xml.soap.SOAPMessage;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;

import org.fusesource.camel.model.Order;
import org.fusesource.camel.model.RepeatOrderResponse;

public class RepeatOrderProcessor implements Processor{

	public SOAPMessage processSOAP(Exchange exchange) {
		
		Order  order = (Order)exchange.getIn().getBody(List.class).get(0);
	           
	           RepeatOrderResponse repeatOrderResponse = new RepeatOrderResponse();
	           repeatOrderResponse.setName("Order Succesfully Repeated , order sent by " + order.getName());
	           repeatOrderResponse.setAmount(order.getAmount()*100);
	           
	           exchange.getOut().setBody(repeatOrderResponse,RepeatOrderResponse.class);
	           return null;
	   }
	       @Override
	       public void process(Exchange exchange) throws Exception {
	               processSOAP(exchange);
	       }
	 
	
	
}
